#!/bin/bash
# 作用：启/停Kafka
if [ $# -ne 1 ]
then
	echo "请输入正确指令start/stop" && exit
fi

case $1 in
"start")
	echo "========== 启动Kafka集群 =========="
	for host in hadoop102 hadoop103 hadoop104
	do
		echo "---------- 启动$host的Kafka ----------"
		ssh $host "kafka-server-start.sh -daemon /opt/module/kafka-3.0.0/config/server.properties"
	done
;;
"stop")
	echo "========== 关闭Kafka集群 =========="
	for host in hadoop102 hadoop103 hadoop104
	do
		echo "---------- 关闭$host的Kafka ----------"
		ssh $host "kafka-server-stop.sh"
	done
;;
*)
	echo "请输入正确指令start/stop" && exit
;;
esac